package com.xb.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xb.model.domain.entity.VipPackage;
import com.xb.system.mapper.db1.VipPackageMapper;
import com.xb.system.service.VipPackageService;
import org.springframework.stereotype.Service;

@Service
public class VipPackageServiceImpl extends ServiceImpl<VipPackageMapper, VipPackage>
        implements VipPackageService {

    @Override
    public VipPackage getUserPackage(Long userId) {
        return this.getOne(
                new QueryWrapper<VipPackage>()
                        .eq("user_id", userId)
                        .eq("is_deleted", 0)
                        .orderByDesc("create_time")
                        .last("LIMIT 1")
        );
    }
}